<?php

/*	Vulpes - Web-based managegent for wireless internet providers.
	Copyright (C) 2007 Alwin Garside

	This file is part of Vulpes.

	Vulpes is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Vulpes is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>. */

require('vulpes.php');

$sql_clients = 'SELECT * FROM `clients`';
$result_clients = query($sql_clients);

while ($client = mysql_fetch_object($result_clients))
{
	$iptables .= 'sudo /sbin/iptables -A FORWARD -s ' .$client->ip. ' -m mac --mac-source ' .$client->mac. " -j ACCEPT\n";
	$iptables .= 'sudo /sbin/iptables -A INPUT -s ' .$client->ip. ' -m mac --mac-source ' .$client->mac. " -j ACCEPT\n";
	$iptables .= 'sudo /sbin/iptables -A OUTPUT -s ' .$client->ip. " -j ACCEPT\n";
}

$output = exec($iptables);

echo $output;


?>